package com.tj.bo.account.client.enums;

/**
 * @program: binary-option
 * @description
 * @author: frank
 * @create: 2020-08-27 10:49
 **/
public enum GrantTypeEnum {

    DEPOSIT_BONUS(0, "Deposit Bonus", "DEPOSIT"),
    INVITE_FRIEND_BONUS(1, "Invite Friends Bonus", "BONUS");

    GrantTypeEnum(Integer code, String name, String income) {
        this.code = code;
        this.name = name;
        this.income = income;
    }

    private Integer code;
    private String name;
    private String income;

    public Integer getCode() {
        return code;
    }

    public GrantTypeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public GrantTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public String getIncome() {
        return income;
    }

    public GrantTypeEnum setIncome(String income) {
        this.income = income;
        return this;
    }

    public static GrantTypeEnum getByIncome(String income){
        for(GrantTypeEnum typeEnum: GrantTypeEnum.values()){
            if(typeEnum.income.equalsIgnoreCase(income)){
                return typeEnum;
            }
        }
        return null;
    }

}
